package com.example.demospringmybatisplus.soTokenController;

/**
 * 登录认证控制层
 *
 * @author huahua
 * @DATE 2024/8/23
 **/
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;

/**
 * 登录认证测试
 *
 * @author huahua
 * @DATE 2024/8/23
 */
@RestController
@RequestMapping("/acc/")
public class LoginController {

    // 查询 Token 信息  ---- http://localhost:8086/acc/tokenInfo
    @RequestMapping("tokenInfo")
    public SaResult tokenInfo() {
        return SaResult.data(StpUtil.getTokenInfo());
    }

    // 测试注销  ---- http://localhost:8086/acc/logout
    @RequestMapping("logout")
    public SaResult logout() {
        StpUtil.logout();
        return SaResult.ok();
    }
}
